#pragma once
#include <QThread>
#include <QSharedPointer>
#include <QAbstractSocket>
#include "payload.h"
#include "concurrentqueue.h"
#include "wireformat.h"

namespace apollo
{
	namespace core
	{
		class ConnectionReader : public QThread
		{
		private:
			QSharedPointer<QAbstractSocket> socket;
			QSharedPointer<WireFormat> format;
			ConcurrentQueue<PayloadPtr> * queue;
			volatile bool isStop;
		public:
			ConnectionReader(QSharedPointer<QAbstractSocket> socket, ConcurrentQueue<PayloadPtr> * queue,QSharedPointer<WireFormat> format);
			~ConnectionReader(void);
			void stop() {isStop = true;}
			virtual void run();
		};
	}}